TextButton( child: Text('Text'), style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)), onPressed: () { // action on pressed }, ),